import urllib.request
url = "https://m.douban.com/rexxar/api/v2/subject/recent_hot/movie?start=20&limit=120&ck=efdK"
headers = {
    'user-agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36',
    'referer':'https://movie.douban.com/explore'
}
req = urllib.request.Request(url,headers=headers)
resp = urllib.request.urlopen(req)
json = resp.read().decode("utf-8")
# print(type(json),json)
json = json.replace('true','True').replace('false','False')
d = dict(eval(json))
print(d["items"])
for x in d["items"]:
    print(f'{x["title"]}{x["rating"]["value"]}')
# print(type(json),json)
# import ast
# d = ast.literal_eval(json)
# print(d)
